#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "comsetdialog.h"
#include <QSerialPort>
#include "remotecontrolwidget.h"
#include <QTextBrowser>
#include <QWidget>
#include "mysubwindow.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class ComSetDialog;
class RemoteControlWidget;

struct WorkerParams {
    int m_timeout;       // 超时时间

    WorkerParams(int timeoutVal = 0)
        : m_timeout(timeoutVal) {}
    WorkerParams(const WorkerParams& prams){m_timeout=prams.m_timeout;}
};
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

public slots:

    void appendLog(const QString& text);

    void on_action_ComSet_triggered();

    void popMessageBox(const QString &reason);


protected:
    void moveEvent(QMoveEvent *event) override ;

private slots:
    void on_action_Energy_triggered();

    void on_action_remotectrl_triggered();

    void moveAllChildWindows(const QPoint& delta);

private:
    Ui::MainWindow *ui;
    QMdiSubWindow* m_ComSet;            //通讯设置窗口
    QMdiSubWindow* m_remote_ctrl;       //远程控制窗口
    QMdiSubWindow* m_readEnergy;
    QSerialPort* m_serialPort;

    QPoint m_lastPos;
};
#endif // MAINWINDOW_H
